package cn.zhouyafeng.itchat4j.core;

import java.util.Hashtable;
import java.util.Map;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: ZhaoTao
 * \* Date: 2017/12/11
 * \* Time: 9:46
 * \* Description: 用于群发的核心储存类
 * \
 */
public class MultiCore extends Core{

    private static Map<String, MultiCore> multiCoreMap = new Hashtable<>();

    private MultiCore() {
        super();
    }

    public static MultiCore getInstance() {
        return null;
    }

    private static MultiCore getNewInstance(String key) {
        MultiCore multiCore = new MultiCore();
        multiCoreMap.put(key, multiCore);
        return multiCore;
    }

    public static MultiCore getInstance(String key) {
        if (multiCoreMap.containsKey(key)) {
            return multiCoreMap.get(key);
        }else {
            return getNewInstance(key);
        }

    }

    public static void remove(String key) {
        if (multiCoreMap.containsKey(key)) {
            multiCoreMap.remove(key);
        }
    }
}
